package config

import (
	"common/helper"
	"database/sql"
)

/*
流水返利配置
*/

type CfgRunningReturnItem struct {
	Running    float64 `json:"running" db:"running" cbor:"running"`
	ReturnRate int     `json:"return_rate" db:"return_rate" cbor:"return_rate"`
}
type CsRunningReturnCfg struct{}

var cfgList []CfgRunningReturnItem

func (that *CsRunningReturnCfg) GetCfg() []CfgRunningReturnItem {
	return cfgList
}

func (that *CsRunningReturnCfg) removeAllCfg() {
	cfgList = []CfgRunningReturnItem{}
}

func RunningReturnCfgRemove() {
	cfgList = []CfgRunningReturnItem{}
}

func RunningReturnCfgSetRow(rows *sql.Rows) {
	var tVal CfgRunningReturnItem
	var err error
	err = rows.Scan(&tVal.Running, &tVal.ReturnRate)
	if err != nil {
		helper.InfoLog("RunningReturnCfgSetRow,scan err")
		return
	}

	cfgList = append(cfgList, tVal)

}
